home *** CD-ROM | disk | FTP | other *** search
- global gDBTextVarList
-
- on InitLayOut
- MyObj = getaProp(gDBTextVarList, GetObjProp())
- ShowTitle()
- EnableScroll = ShowText()
- InitScroll()
- InitButtons(EnableScroll)
- updateStage()
- SetScrollHandler()
- InitRollOverText(MyObj)
- end
-
- on ShowTitle
- MyObj = getaProp(gDBTextVarList, GetObjProp())
- SpriteList = GetSpriteList(MyObj)
- TitleSprite = getaProp(SpriteList, #title)
- xMember = member("title f")
- puppetSprite(TitleSprite, 1)
- set the textHeight of member xMember to 14
- set the member of sprite TitleSprite to xMember
- xLoc = point(20, 5)
- if the machineType = 256 then
- set the loc of sprite TitleSprite to xLoc + point(0, -1)
- else
- set the loc of sprite TitleSprite to xLoc
- end if
- end
-
- on ShowText
- MyObj = getaProp(gDBTextVarList, GetObjProp())
- xMember = GetMemberNum(MyObj)
- EnableScroll = 0
- SpriteList = GetSpriteList(MyObj)
- TextSprite = getaProp(SpriteList, #text)
- puppetSprite(TextSprite, 1)
- set the member of sprite TextSprite to xMember
- MinRect = GetTextRect(MyObj, 1)
- if the machineType = 256 then
- set the textHeight of member xMember to 14
- end if
- member(xMember).rect = MinRect
- if member(xMember).height > (GetRectHeight(MinRect) + 7) then
- EnableScroll = 1
- end if
- member(xMember).scrollTop = 0
- set the loc of sprite TextSprite to point(getAt(MinRect, 1), getAt(MinRect, 2))
- return EnableScroll
- end
-
- on CharMap xMember
- if the machineType = 256 then
- if count(the windowList) > 0 then
- FieldFindandReplace(xMember, numToChar(147), QUOTE)
- FieldFindandReplace(xMember, numToChar(148), QUOTE)
- FieldFindandReplace(xMember, numToChar(145), "'")
- FieldFindandReplace(xMember, numToChar(146), "'")
- end if
- end if
- end
-
- on FieldFindandReplace xMember, FindText, ReplaceText
- xText = member(xMember).text
- PositionList = []
- start = the ticks
- repeat while xText contains FindText
- Pos = offset(FindText, xText)
- append(PositionList, Pos)
- put " " into char Pos of xText
- end repeat
- Jat((the ticks - start) / 60.0)
- start = the ticks
- repeat with xItem in PositionList
- put ReplaceText into char xItem of field xMember
- end repeat
- Jat((the ticks - start) / 60.0)
- end
-
- on InitScroll
- MyObj = getaProp(gDBTextVarList, GetObjProp())
- ButtonList = GetButtonList(MyObj)
- xMember = GetMemberNum(MyObj)
- InnerRect = GetInsideRect(2)
- TextRect = GetTextRect(MyObj, 1)
- SpriteList = GetSpriteList(MyObj)
- SetPuppetState(SpriteList, 0, 1)
- NArrowSp = getaProp(SpriteList, #NArrow)
- SArrowSp = getaProp(SpriteList, #SArrow)
- ThumbSp = getaProp(SpriteList, #VThumb)
- BedSp = getaProp(SpriteList, #VBed)
- sL = getAt(InnerRect, 3) - the width of sprite NArrowSp
- sT = getAt(TextRect, 2)
- sR = getAt(InnerRect, 3)
- sB = getAt(InnerRect, 4)
- set the rect of sprite BedSp to rect(sL, sT, sR, sB)
- set the rect of sprite NArrowSp to rect(sL, sT, sR, sT + the height of sprite NArrowSp)
- set the rect of sprite SArrowSp to rect(sL, sB - the height of sprite SArrowSp, sR, sB)
- ThumbXLoc = sL + (the width of sprite NArrowSp / 2)
- ThumbMin = sT + the height of sprite NArrowSp - 2 + (the height of sprite ThumbSp / 2)
- ThumbMax = sB - the height of sprite SArrowSp - (the height of sprite ThumbSp / 2)
- set the loc of sprite ThumbSp to point(ThumbXLoc, ThumbMin)
- MinRect = GetTextRect(MyObj, 1)
- numLines = member(xMember).lineCount
- numVisLines = GetRectHeight(MinRect) / the textHeight of member xMember
- numSettings = numLines - numVisLines + 1
- addProp(ButtonList, ThumbSp, new(script("scroll Thumb subclass"), "v scroll", "global", ThumbSp, ThumbXLoc, ThumbMin, ThumbMax, 1, numSettings, 1, numSettings, 0, 0, #downOrRight))
- Slider = getaProp(ButtonList, ThumbSp)
- addProp(ButtonList, BedSp, new(script("scroll bed subclass"), "v scroll", "global", BedSp, RectToLoc(rect(sL, sT, sR, sB)), Slider, 15))
- addProp(ButtonList, NArrowSp, new(script("scroll button"), "scrollup", "global", NArrowSp, the loc of sprite NArrowSp, Slider, 0))
- addProp(ButtonList, SArrowSp, new(script("scroll button"), "scrolldown", "global", SArrowSp, the loc of sprite SArrowSp, Slider, 1))
- SetButtonList(MyObj, ButtonList)
- end
-
- on SetScrollHandler
- MyObj = getaProp(gDBTextVarList, GetObjProp())
- init(MyObj)
- end
-
- on GetInsideRect xSprite, xRect
- if voidp(xRect) then
- xRect = the rect of sprite xSprite
- end if
- xLineSize = the lineSize of sprite xSprite
- return xRect + rect(xLineSize, xLineSize, -xLineSize, -xLineSize)
- end
-